<template>
	<view class="logcontent">
		<view @click="handeleItem(index,item)" v-for="(item,index) in list" :key="index"
			:class="index===indexID?'itemList_active':'itemList'">
			{{lang==='zh'?item.title:item.title_ru}}
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				indexID: '', //下标
				lang: 'zh',
				list: [{ //顶部选项
						id: '1',
						title: '车源信息',
						title_ru: 'Информация о транспорте'
					},
					{
						id: '2',
						title: '货源信息',
						title_ru: 'Информация о посылках'
					},
					{
						id: '3',
						title: '小件货源',
						title_ru: 'Небольшая посылка'
					},
				]
			}
		},
		onLoad() {
			// 获取语言
			this.getLang()
		},
		methods: {
			// 点击选项
			handeleItem(index, item) {
				this.indexID = index
				let title = this.lang === 'zh' ? item.title : item.title_ru
				uni.navigateTo({
					url: '/pages/index/transportList/transport1?id=' + item.id + '&title=' + title
				})
			},
			// 获取语言
			getLang() {
				// 获取缓存lang当前语言值
				uni.getStorage({
					key: 'lang',
					success: res => {
						if (res.data == 'zh') { //zh为中国，赋值0
							this.lang = 'zh'
						} else { //其他为俄罗斯，赋值1
							this.lang = 'ru'
						}
					}
				});
			},
		},
		onReady() {
			uni.setNavigationBarTitle({
				title: this.$t("选择运输订单类型")
			})
		},
	}
</script>

<style scoped>
	.itemList_active {
		width: 690rpx;
		height: 100rpx;
		background: linear-gradient(100deg, #D3EF93 2%, rgba(229, 245, 203, 0.24) 61%);
		border-radius: 8rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 36rpx;
		margin-top: 30rpx;
	}

	.itemList {
		width: 690rpx;
		height: 100rpx;
		background-color: #FFFFFF;
		border-radius: 8rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 36rpx;
		margin-top: 30rpx;
	}

	.logcontent {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
	}
</style>
<style>
	page {
		background-color: #F6F6F6;
	}
</style>